package AdapterPattern;

/**
 * @version: java version 1.8
 * @Author: Zheng
 * @description:
 * @date: 2022-08-14 11:16
 */
public class AudioPlayer implements MediaPlayer{
    MediaAdapter mediaAdapter;


    @Override
    public void play(String audioType, String fileName) {
        // 播放MP3音乐文件的内置支持
        if (audioType.equalsIgnoreCase("mp3")){
            System.out.println("mp3:"+fileName);
        }else if (audioType.equalsIgnoreCase("vlc")|| audioType.equalsIgnoreCase("mp4")){
            mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType,fileName);
        }else {
            System.out.println("格式："+audioType);
        }
    }
}
